import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home/index'
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('@/views/Home'),
    // 二级路由
    children: [{
      path: '/home/index',
      name: 'Index',
      component: () => import('@/views/Index')
    },{
      path: '/home/my',
      name: 'My',
      component: () => import('@/views/My')
    },{
      path: '/home/car',
      name: 'Car',
      component: () => import('@/views/Car')
    },
    {
      path: '/home/classify',
      name: 'Classify',
      component: () => import('@/views/Classify')
    }]
  }, 
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
